package com.example.demo;

import java.util.Calendar;
import java.util.Date;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.enums.BallEnum;
import com.example.pojo.CommonJSONResult;
import com.example.pojo.Student;

/**
 * @ClassName: UserController
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author liuwj3
 * @date 2018年11月25日 下午8:49:49
 *
 */
@RestController
@RequestMapping("/student")
public class StudentController {
	
	@GetMapping("/getStudent")
	public CommonJSONResult getStudent() {
		Student a = new Student();
		a.setName("刘文钊");
		a.setAge(18);
		a.setBallEnum(BallEnum.BASKET_BALL);
		Calendar c = Calendar.getInstance();
		// Calendar的月份为实际值减1
		c.set(1995, 10 - 1, 19);
		a.setBirthday(new Date(c.getTimeInMillis()));
		
		// a.setDes("这是一条学生信息记录，请查看！");
		
		CommonJSONResult build = CommonJSONResult.build(200, "查询学生信息成功", a);
		
		return build;
	}
	
	@GetMapping("/getBallEnum")
	public Student getBallEnum(Student s) {
		System.out.println(s);
		return s;
	}
	
	@GetMapping("/getBallEnum2")
	public BallEnum getBallEnum(BallEnum s) {
		System.out.println(s);
		return s;
	}

}
